package drds.binlog.data_object;


import com.google.gson.annotations.SerializedName;
import drds.binlog.common.Authors;
import drds.common.Author;
import lombok.Getter;
import lombok.Setter;

@Author(name = Authors.LI_YANG)
public final class Entry extends DataObject
{


    //
    @SerializedName("entryTypeValue")
    @Setter
    @Getter
    public Object entryTypeValue;

    //
    @SerializedName("header")
    @Setter
    @Getter
    public Header header = null;

    //
    @SerializedName("dataObject")
    @Setter
    @Getter
    private DataObject dataObject;


    public Entry setHeader(Header header)
    {
        if (header == null)
        {
            throw new NullPointerException();
        }
        this.header = header;

        return this;
    }

    public EntryType getEntryType()
    {
        @SuppressWarnings("deprecation")
        EntryType result = EntryType.valueOf(
                (Integer) entryTypeValue);
        return result == null ? EntryType.unrecognized : result;
    }

    public Entry setEntryType(EntryType entryType)
    {
        if (entryType == null)
        {
            throw new NullPointerException();
        }

        entryTypeValue = entryType.getNumber();

        return this;
    }


}
